﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FullThrustLogic.Core;
using FullThrustLogic.ShipComponent;

namespace FTLiteLogic.AI.AIStrategy
{
    public class MoveLargerShipIntoRangeOfSmallerShip : IAIStrategy
    {
        public void ApplyStrategy(GameContext currentContext, Player currentPlayer)
        {
            foreach (Ship aiPlayerShip in currentContext.Players[(int)currentPlayer.PlayerType].Ships)
            {
                FindSmallestShipInRange(aiPlayerShip, currentContext, currentPlayer);
            }
        }

        private void FindSmallestShipInRange(Ship aiPlayerShip, GameContext currentContext, Player currentPlayer)
        {

            List<Ship> shipsInRange = new List<Ship>();

            foreach(Player otherPlayer in currentContext.Players)
            {
                if(otherPlayer.PlayerType != currentPlayer.PlayerType)
                {
                    foreach(Ship otherShip in otherPlayer.Ships)
                    {
                        if (CanReachShip(aiPlayerShip))
                        {
                            shipsInRange.Add(otherShip);
                        }
                    }
                }
            }
        }

        private bool CanReachShip(Ship aiPlayerShip)
        {
            throw new NotImplementedException();
        }
    }
}
